<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <input type="text" id="inp">
    <div id="div" style="width: 200px; height:200px; background-color:black"></div> -->
    <div id="div">
        <input type="radio" name="a" id="" value="banana">banana
        <input type="radio" name="a" id="" value="apple">apple
        <input type="radio" name="a" id="" value="orange">orange
        <input type="text" placeholder="百度一下">
    
        
        <input type="checkbox" name="b" id="ndiv" value="mouse">mouse
        <input type="checkbox" name="b" id="ndiv" value="dog">dog
        <input type="checkbox" name="b" id="ndiv" value="cat">cat
        <input type="checkbox" name="b" id="ndiv" value="pig">pig
    </div>
   
    <p></p>
</body>
<script>
    
    //onchange获取多选框的值
    var div = document.getElementById('div');
    
    div.onchange = function () {
             var kong = '';
             var input = document.getElementsByTagName('input');
             var len = input.length;
 
        for (var i = 0; i < len; i++) {
          
            if (input[i].checked == true) {
                kong += input[i].value;
                
            }
        }
        var p = document.querySelector('p');
        p.innerText = '您选择的是'+kong
    }

    
</script>

</html>